<template>
  <div class="detail-page">
    <van-nav-bar
      left-text="返回"
      fixed
      title="面经详细"
    />
    <header class="header">
      <h1>标题</h1>
      <p>
        2022-09-21 | 3032 浏览量 |
        20 点赞数
      </p>
      <p>
        <img src="http://xpzll.gitee.io/hmmj-demo/img/logo.dbd40807.png" alt="" />
        <span>资深前端</span>
      </p>
    </header>
    <main class="body"></main>
    <div class="opt">
      <van-icon class="active" name="like-o"/>
      <van-icon class="active" name="star-o"/>
    </div>
  </div>
</template>

<script>
// 导入接口
import { detailAPI } from '@/api/article'
export default {
  name: 'detail-page',

  // 因为页面一打开就要发请求就写created
  async created () {
    const res = await detailAPI({
      id: this.$route.params.id
    })

    console.log(res)
  }
};
</script>

<style lang="less" scoped>
.detail-page {
  margin-top: 44px;
  overflow: hidden;
  padding: 0 15px;
  .header {
    h1 {
      font-size: 24px;
    }
    p {
      color: #999;
      font-size: 12px;
      display: flex;
      align-items: center;
    }
    img {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      overflow: hidden;
    }
  }
  .opt {
    position: fixed;
    bottom: 100px;
    right: 0;
    > .van-icon {
      margin-right: 20px;
      background: #fff;
      width: 40px;
      height: 40px;
      line-height: 40px;
      text-align: center;
      border-radius: 50%;
      box-shadow: 2px 2px 10px #ccc;
      font-size: 18px;
      &.active {
        background: #FEC635;
        color: #fff;
      }
    }
  }
}
</style>